const formatTimeUse = value => {
  // let hours = Math.floor((this.timeUse % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
  let minutes = Math.floor((value % (1000 * 60 * 60)) / (1000 * 60))
  let seconds = Math.floor((value % (1000 * 60)) / 1000)
  // hours = hours < 10 ? ('0' + hours) : hours
  minutes = minutes < 10 ? ('0' + minutes) : minutes
  seconds = seconds < 10 && seconds >= 0 ? ('0' + seconds) : seconds
  return  `${minutes}分${seconds}秒`
}
function reqP(promise, {loadingMsg = '加载中', errMsg = '请求出错！'} = {}){
  this.$toast.loading({
    duration: 0,
    mask: true,
    message: loadingMsg
  });
  return new Promise((resolve, reject) => {
    promise.then(res => {
      this.$toast.clear()
      resolve(res)
    }).catch(err => {
      this.$toast.clear()
      this.$toast.fail(errMsg)
      reject(err)
    })
  })
}
export default {
  formatTimeUse,
  reqP
}
